package com.njlime.cms.repository.app;

import com.njlime.cms.entities.TColumn;
import com.njlime.core.base.repository.impl.BaseDaoImpl;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @version V1.0
 * @ClassName: ColumnJdbcDao.java
 * @Description: 专业管理
 * @Date 2016-4-22 上午11:45:46
 */
@Repository
public class AppColumnDaoImpl extends BaseDaoImpl<TColumn> {
    Logger logger = Logger.getLogger(AppColumnDaoImpl.class);

    /**
     * 获取栏目列表
     * @param channelId
     * @return
     */
    public List<Map<String,Object>> columnList(int channelId,String unitId){
        StringBuilder sb = new StringBuilder();
        List<Object> arrList = new ArrayList<Object>();
        sb.append("SELECT t.* from t_column t ");
        sb.append("join t_channel_column t1 on t1.t_column_id = t.id ");
        sb.append("where  t.is_del = 0 and t.unit_id = ? and t.channel_id = ? order by t1.short_num");
        arrList.add(unitId);
        arrList.add(channelId);
        return getListJdbc(sb.toString(), arrList);
    }
}
